<?
$data = json_decode(@file_get_contents("php://input"), true);

$url = "http://cache.neea.edu.cn/cet/query?";

$post = "data=CET4_192_DANGCI%2C" . $data['id'] . "%2C" . rawurlencode($data['name']) . "&v=" . $data['yzm'];
$session = $data['session'];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_REFERER, "http://cet.neea.edu.cn/cet/");
curl_setopt($ch, CURLOPT_COOKIE, $session);
$output = curl_exec($ch);
curl_close($ch);

//var_dump( $output);

$z =  explode("'", (explode("z:'", $output))[1])[0]; //准考证号
$n =  explode("'", (explode("n:'", $output))[1])[0]; //名字
$x =  explode("'", (explode("x:'", $output))[1])[0]; //学校
$s =  explode(",", (explode("s:", $output))[1])[0]; //总分
$t =  explode(",", (explode("t:", $output))[1])[0]; //不知道
$id =  explode("'", (explode("id:'", $output))[1])[0]; //成绩报告单
$l =  explode(",", (explode("l:", $output))[1])[0]; //听力
$r =  explode(",", (explode("r:", $output))[1])[0]; //阅读
$w =  explode(",", (explode("w:", $output))[1])[0]; //写作和翻译
$kyz =  explode("'", (explode("kyz:'", $output))[1])[0]; //口语准考证
$kys =  explode("'", (explode("kys:'", $output))[1])[0]; //口语等级





$result = array('err' => 0, $z, $n, $x, $s, $t, $id, $l, $r, $w, $kyz, $kys);
exit(json_encode($result));
